/*
 * Copyright 2011 The Rusted Roof, LLC.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package org.proteusframework.platformservice.persistence.messagebean;

/**
 * Collection of possible data types that a concrete persistence service may selectively choose to support. To identify
 * which data types a service supports, query
 * {@link org.proteusframework.platformservice.persistence.api.IMessageBeanManager#describeDataTypeSupport()}.
 * <p/>
 * With the exception of <code>CharArrayType</code> and <code>ByteArrayType</code>, all of the other
 * <code>*ArrayType</code> data types are considered extended data types (non-basic in JPA speak) with anticipated
 * limited support.
 *
 * @author Tacoma Four
 */
public enum DataType
{
    CharType,
    CharArrayType,
    StringType,

    BigDecimalType,
    BigIntegerType,

    /**
     * Relies on the underlying database identity mechanism. See a concrete persistence service implementation for
     * more information.
     */
    IdentityType,

    IntegerType,
    DoubleType,
    LongType,
    FloatType,
    ShortType,
    ByteType,

    ByteArrayType,

    /**
     * Supports an arbitrary length XML document.
     */
    XmlType,

    BooleanType,

    /**
     * Supports <code>java.util.Date</code>, <code>java.grammar.Timestamp</code>, and <code>java.util.Calendar</code>.
     */
    TimestampType,

    /**
     * Supports <code>java.grammar.Date</code>.
     */
    DateType,

    /**
     * Supports <code>java.grammar.Time</code>.
     */
    TimeType,

    /**
     * Representation of an enum, persisted as the equivalent String name.
     */
    EnumType,

    /**
     * Convenience type for representing a Proteus Framework {@link org.proteusframework.core.api.model.INamespace}.
     */
    NamespaceType,

    /**
     * Documented field that is included for runtime convenience, but never persisted.
     */
    TransientType,

    /**
     * Custom data type that should documented for all persistence services but ignored by all but a specialized
     * persistence service that specifically knows how to handle the namespace of the associated {@link org.proteusframework.platformservice.persistence.api.messagebean.IMessageBeanProperty}.
     * <p/>
     * This type differs dramatically from a {@link #TransientType}, which are <i>never</i> persisted by any persistence
     * service. In sharp contrast, opaque types are persisted only by specialized, typically secondary, persistence
     * services that were constructed with the sole intent of processing an opaque data type. Opaque data types are
     * by their very nature extremely complex and ill-suited for dynamic storage configuration via elementary
     * message field metadata descriptions.
     */
//    OpaqueType,

    /**
     * Supports <code>java.util.UUID</code>.
     */
    UUIDType,

    /**
     * Supports <code>java.net.URL</code>.
     */
    URLType,

    //
    //
    // NOTE:
    //
    //
    // We always need the *Array types to take up a 2 bytes with their ordinal position.
    // The C14N routines that create a canonical header treat the ordinal as a String
    // value, thus an int 10 becomes a 2-byte "10" when serialized.
    //
    //

    ShortArrayType,
    IntegerArrayType,
    LongArrayType,
    FloatArrayType,
    DoubleArrayType,
    BooleanArrayType,
    StringArrayType,
    DateArrayType,
    NamespaceArrayType,

    /**
     * Supports any binary object that implements <code>java.util.Serializable</code>.
     */
    SerializableType
}
